package com.catering.controller.untilController;

import com.catering.service.CateringOrderService;
import com.catering.service.utils.FrontService;
import com.catering.service.utils.UntilService;
import com.catering.until.EventTypeEnum;
import com.catering.until.Log;
import com.catering.until.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/front")
public class BackController {

	@Autowired
	private FrontService frontService;
	@Autowired
	private CateringOrderService cateringOrderService;
	@Autowired
	private UntilService untilService;

	//商品信息列表
	@RequestMapping("/cateringGoods/select")
	public ResultData cateringGoodsSelect(@RequestBody Map<String,String> map) {
		return frontService.cateringGoodsSelect(map);
	}
	//商品信息修改
	@RequestMapping("/cateringGoods/insert")
	@Log(operation = "新增",remark = "【商品信息】新增商品信息",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringGoodsInsert(@RequestBody Map map) {
		return frontService.cateringGoodsInsert(map);
	}
	//商品信息修改
	@RequestMapping("/cateringGoods/update")
	@Log(operation = "修改",remark = "【商品信息】修改商品信息",event = EventTypeEnum.BUSINESS ,type = "4")
	public ResultData cateringGoodsUpdate(@RequestBody Map map) {
		return frontService.cateringGoodsUpdate(map);
	}
	//商品信息删除
	@RequestMapping("/cateringGoods/delete")
	@Log(operation = "删除",remark = "【商品信息】删除商品信息",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringGoodsDelete(@RequestBody Map map) {
		return frontService.cateringGoodsDelete(map);
	}

	//父级规格列表
	@RequestMapping("/parentSpaces/select")
	public ResultData parentSpacesSelect(@RequestBody Map map) {
		return frontService.cateringSpacesSelect(map);
	}
	//封装父级和子级规格列表
	@RequestMapping("/spacesChild/select")
	public ResultData spacesChildSelect(@RequestBody Map map) {
		return frontService.spacesChildSelect(map);
	}
	//父级规格修改
	@RequestMapping("/parentSpaces/insert")
	@Log(operation = "新增",remark = "【父级规格】新增父级规格",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData parentSpacesInsert(@RequestBody Map map) {
		return frontService.cateringSpacesInsert(map);
	}
	//父级规格修改
	@RequestMapping("/parentSpaces/update")
	@Log(operation = "修改",remark = "【父级规格】修改父级规格",event = EventTypeEnum.BUSINESS ,type = "4")
	public ResultData parentSpacesUpdate(@RequestBody Map map) {
		return frontService.cateringSpacesUpdate(map);
	}
	//父级规格删除
	@RequestMapping("/parentSpaces/delete")
	@Log(operation = "删除",remark = "【父级规格】删除父级规格",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData parentSpacesDelete(@RequestBody Map map) {
		return frontService.cateringSpacesDelete(map);
	}
	//子级规格列表
	@RequestMapping("/childSpaces/select")
	public ResultData childSpacesSelect(@RequestBody Map<String,String> map) {
		return frontService.childSpacesSelect(map);
	}
	//子级规格新增
	@RequestMapping("/childSpaces/insert")
	@Log(operation = "新增",remark = "【子级规格】新增子级规格",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData childSpacesInsert(@RequestBody Map map) {
		return frontService.childSpacesInsert(map);
	}
	//子级规格修改
	@RequestMapping("/childSpaces/update")
	@Log(operation = "修改",remark = "【子级规格】修改子级规格",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData childSpacesUpdate(@RequestBody Map map) {
		return frontService.childSpacesUpdate(map);
	}
	//子级规格删除
	@RequestMapping("/childSpaces/delete")
	@Log(operation = "新增",remark = "【子级规格】修改子级规格",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData childSpacesDelete(@RequestBody Map map) {
		return frontService.childSpacesDelete(map);
	}

	//商品优惠券列表
	@RequestMapping("/cateringCoupon/select")
	public ResultData cateringCouponelect(@RequestBody Map map) {
		return frontService.cateringCouponSelect(map);
	}
	//商品优惠券新增
	@RequestMapping("/cateringCoupon/insert")
	@Log(operation = "新增",remark = "【优惠券表】新增优惠券表",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringCouponInsert(@RequestBody Map map) {
		return frontService.cateringCouponInsert(map);
	}
	//商品优惠券修改
	@RequestMapping("/cateringCoupon/update")
	@Log(operation = "修改",remark = "【优惠券表】修改优惠券表",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringCouponUpdate(@RequestBody Map map) {
		return frontService.cateringCouponUpdate(map);
	}
	//商品优惠券删除
	@RequestMapping("/cateringCoupon/delete")
	@Log(operation = "新增",remark = "【优惠券表】修改优惠券表",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringCouponDelete(@RequestBody Map map) {
		return frontService.cateringCouponDelete(map);
	}

	//商品评论
	@RequestMapping("/cateringDiscuss/select")
	public ResultData cateringDiscussSelect(@RequestBody Map map) {
		return frontService.cateringDiscussSelect(map);
	}
	//商品评论新增
	@RequestMapping("/cateringDiscuss/insert")
	@Log(operation = "新增",remark = "【商品评论】新增商品评论",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringDiscussInsert(@RequestBody Map map) {
		return frontService.cateringDiscussInsert(map);
	}
	//商品评论修改
	@RequestMapping("/cateringDiscuss/update")
	@Log(operation = "修改",remark = "【商品评论】修改商品评论",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringDiscussUpdate(@RequestBody Map map) {
		return frontService.cateringDiscussUpdate(map);
	}
	//商品评论删除
	@RequestMapping("/cateringDiscuss/delete")
	@Log(operation = "新增",remark = "【商品评论】修改商品评论",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringDiscussDelete(@RequestBody Map map) {
		return frontService.cateringDiscussDelete(map);
	}

	//用户列表
	@RequestMapping("/cateringUser/select")
	public ResultData cateringUserSelect(@RequestBody Map map) {
		return frontService.cateringUserSelect(map);
	}
	//用户新增
	@RequestMapping("/cateringUser/insert")
	@Log(operation = "新增",remark = "【用户信息】新增用户信息",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringUserInsert(@RequestBody Map map) {
		return frontService.cateringUserInsert(map);
	}
	//用户修改
	@RequestMapping("/cateringUser/update")
	@Log(operation = "修改",remark = "【用户信息】修改用户信息",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringUserUpdate(@RequestBody Map map) {
		return frontService.cateringUserUpdate(map);
	}
	//用户删除
	@RequestMapping("/cateringUser/delete")
	@Log(operation = "新增",remark = "【用户信息】修改用户信息",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringUserDelete(@RequestBody Map map) {
		return frontService.cateringUserDelete(map);
	}

	//用户订单列表
	@RequestMapping("/cateringOrder/select")
	public ResultData cateringOrderSelect(@RequestBody Map<String,String> map) {
		return frontService.cateringOrderSelect(map);
	}
	//用户订单新增
	@RequestMapping("/cateringOrder/insert")
	@Log(operation = "新增",remark = "【用户订单】新增用户订单",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringOrderInsert(@RequestBody Map map) {
		return frontService.cateringOrderInsert(map);
	}
	//用户订单修改
	@RequestMapping("/cateringOrder/update")
	@Log(operation = "修改",remark = "【用户订单】修改用户订单",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringOrderUpdate(@RequestBody Map map) {
		return frontService.cateringOrderUpdate(map);
	}
	@RequestMapping("/cateringOrder/updateStatus")
	@Log(operation = "修改",remark = "【用户订单】修改用户订单",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringOrderUpdateStatus(@RequestBody Map<String,String> map) {
		return frontService.cateringOrderUpdateStatus(map);
	}
	//用户订单删除
	@RequestMapping("/cateringOrder/delete")
	@Log(operation = "新增",remark = "【用户订单】修改用户订单",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringOrderDelete(@RequestBody Map map) {
		return frontService.cateringOrderDelete(map);
	}
	//用户订单详情
	@RequestMapping("/cateringOrderCart/select")
	public ResultData cateringOrderCartSelect(@RequestBody Map map) {
		return frontService.cateringOrderCartSelect(map);
	}
	@Log(operation = "修改" , remark="【用户订单】修改用户订单" , type = "3")
	@RequestMapping("/updateStatus")
	public ResultData updateStatus(@RequestBody Map<String,String> map) {
		return cateringOrderService.updateStatus(map);
	}


	//用户购物车列表
	@RequestMapping("/cateringUserCart/select")
	public ResultData cateringUserCartSelect(@RequestBody Map<String,String> map) {
		return frontService.cateringUserCartSelect(map);
	}
	//用户地址列表
	@RequestMapping("/cateringUserAddress/select")
	public ResultData cateringUserAddressSelect(@RequestBody Map<String,String> map) {
		return frontService.cateringUserAddressSelect(map);
	}
	//用户优惠券列表
	@RequestMapping("/cateringUserCoupon/select")
	public ResultData cateringUserCouponSelect(@RequestBody Map<String,String> map) {
		return frontService.cateringUserCouponSelect(map);
	}
	//用户积分使用列表
	@RequestMapping("/cateringIntegral/select")
	public ResultData cateringIntegralSelect(@RequestBody Map<String,String> map) {
		return frontService.cateringIntegralSelect(map);
	}
	//用户物流跟踪
	@RequestMapping("/cateringOrderLog/select")
	public ResultData cateringOrderLogSelect(@RequestBody Map<String,String> map) {
		return frontService.cateringOrderLogSelect(map);
	}
	//用户反馈
	@RequestMapping("/cateringFeedback/select")
	public ResultData cateringFeedbackSelect(@RequestBody Map<String,String> map) {
		return frontService.cateringFeedbackSelect(map);
	}

	//系统模块列表
	@RequestMapping("/cateringModule/select")
	public ResultData cateringModuleSelect(@RequestBody Map<String,String> map) {
		return frontService.cateringModuleSelect(map);
	}
	//系统模块新增
	@RequestMapping("/cateringModule/insert")
	@Log(operation = "新增",remark = "【系统模块】新增系统模块",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringModuleInsert(@RequestBody Map map) {
		return frontService.cateringModuleInsert(map);
	}
	//系统模块修改
	@RequestMapping("/cateringModule/update")
	@Log(operation = "修改",remark = "【系统模块】修改系统模块",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringModuleUpdate(@RequestBody Map map) {
		return frontService.cateringModuleUpdate(map);
	}
	//系统模块删除
	@RequestMapping("/cateringModule/delete")
	@Log(operation = "新增",remark = "【系统模块】修改系统模块",event = EventTypeEnum.BUSINESS,type = "4")
	public ResultData cateringModuleDelete(@RequestBody Map map) {
		return frontService.cateringModuleDelete(map);
	}



















	@RequestMapping("/enums/select")
	public ResultData selectEnums(@RequestBody Map map) {
		return untilService.selectEnums(map);
	}

}
